package zuoye;
import java.util.ArrayList;
import java.util.List;
class StudentManager {
    private List<Student> students = new ArrayList<>();

    // 新增学生
    public void addStudent(Student student) {
        students.add(student);
    }

    // 维护学生
    public void updateStudent(Student student) {
        for (int i = 0; i < students.size(); i++) {
            if (students.get(i).getId().equals(student.getId())) {
                students.set(i, student);
                break;
            }
        }
    }

    // 学生列表返回学生列表
    public List<Student> getStudentList() {
        return students;
    }

    // 获取学生
    public Student getStudentById(String studentId) {
        for (Student student : students) {
            if (student.getId().equals(studentId)) {
                return student;
            }
        }
        return null;
    }
}

class Student {
    private String id;
    private String name;
    private String groupId;
    private List<AttendanceRecord> attendanceRecords = new ArrayList<>();
    private List<ScoreRecord> scoreRecords = new ArrayList<>();

    public Student(String id, String name, String groupId) {
        this.id = id;
        this.name = name;
        this.groupId = groupId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public List<AttendanceRecord> getAttendanceRecords() {
        return attendanceRecords;
    }

    public List<ScoreRecord> getScoreRecords() {
        return scoreRecords;
    }

    public void addAttendanceRecord(AttendanceRecord record) {
        attendanceRecords.add(record);
    }

    public void addScoreRecord(ScoreRecord record) {
        scoreRecords.add(record);
    }
}

class AttendanceRecord {
    private String date;
    private boolean isPresent;

    public AttendanceRecord(String date, boolean isPresent) {
        this.date = date;
        this.isPresent = isPresent;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public boolean isPresent() {
        return isPresent;
    }

    public void setPresent(boolean present) {
        isPresent = present;
    }
}

class ScoreRecord {
    private String subject;
    private int score;

    public ScoreRecord(String subject, int score) {
        this.subject = subject;
        this.score = score;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

}
